package com.wilmer.ai.utils;

import java.util.List;

/**
 * @author hans
 * @date 2024-05-17 00:06:49
 * @description
 */
public class aiUtils {

    /**
     *将集合逆序-采用双指针法，保证性能最优
     */
    public static <T> void reverseListInPlace(List<T> list) {
        int left = 0;
        int right = list.size() - 1;
        while (left < right) {
            T temp = list.get(left);
            list.set(left, list.get(right));
            list.set(right, temp);
            left++;
            right--;
        }
    }
}
